
#define SW *(unsigned char*)0xe001
#define LED *(unsigned char*)0xe003

void main()
{
unsigned char swBuff;
unsigned char ledBuff = 0;
unsigned char swPattern = 0x01;
unsigned char ledPattern = 0x80;
int i;
  while(1)
  {
     //   LED = (~SW  & 0xfc) | 0xc0 ;  //bit wise
    swBuff = SW;
    for(i=0;i<8;i++)
    {
      if((swBuff & swPattern) != 0)
      {
        ledBuff = ledBuff | ledPattern ;
      }
      swPattern = swPattern << 1;
      ledPattern = ledPattern >>1;
    }
    LED = ledBuff;
    ledBuff = 0;
    swPattern = 0x01;
    ledPattern = 0x80;
  }
}